package RMIService;

import interfase.HelloRegistryFacade;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @author 24270
 */
public class RegistryService {
    public static void main(String[] args) throws RemoteException {
        // 本地主机上的远程对象注册表Registry的实例,默认端口2021
        Registry registry = LocateRegistry.createRegistry(2021);
        // 创建一个远程对象
        HelloRegistryFacade hello = new HelloRegistryFacadeImpl();
        // 把远程对象注册到RMI注册服务器上，并命名为HelloRegistry
        registry.rebind("LiZiKang", hello);
        System.out.println("======= 启动RMI服务成功! =======");
    }
}

